package com.ds.lens.collector.receive.service.dao;

import com.ds.lens.collector.receive.service.dao.entity.LensApplication;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;


/**
 * Description:
 *
 * @author WeiShaoying
 * @date 2019-11-05
 */

@Repository
public interface LensApplicationDao {

    String COLUMNS = " id, name, app_key, creator, created_time, mender, modified_time ";

    @Select({
            "select",
            COLUMNS,
            "from lens_application",
            "where app_key = #{appKey,jdbcType=VARCHAR}"
    })
    @Results(id = "lensApplication", value = {
            @Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "name", property = "name", jdbcType = JdbcType.VARCHAR),
            @Result(column = "app_key", property = "appKey", jdbcType = JdbcType.VARCHAR),
            @Result(column = "creator", property = "creator", jdbcType = JdbcType.VARCHAR),
            @Result(column = "created_time", property = "createdTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "mender", property = "mender", jdbcType = JdbcType.VARCHAR),
            @Result(column = "modified_time", property = "modifiedTime", jdbcType = JdbcType.TIMESTAMP)
    })
    LensApplication selectAppByAppKey(String appKey);



}
